<?php $post = $this->getPost();?>

<div id="messages_product_view"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>



<div class="title">
	<div class="pagebar">
		<?php $this->getPages(); ?>
	</div>
	<h1><a href="<?php echo $post->getAddress(); ?>" ><?php echo $post->getTitle();?></a></h1>
</div>
<div class="page">
<?php 
$_imgurl=$post->getNfile();
if($_imgurl){
	echo '<a href="'.Mage::getBaseUrl('media').$_imgurl.'" rel="lightbox"><img src="'.Mage::getBaseUrl('media').$_imgurl.'" onload="if(this.width>500) this.width=500"></a>';
}
?>
	<?php echo $post->getPostContent(); ?>
</div>

<?php /*
<div class="postWrapper">
	<div class="postTitle">
        <h2><a href="<?php echo $post->getAddress(); ?>" ><?php echo $post->getTitle();?></a></h2>
		<h3><?php echo $post->getCreatedTime(); ?></h3>
    </div>
	
	<div class="postContent"><?php echo $post->getPostContent(); ?></div>
	<?php echo $this->getBookmarkHtml($post) ?>
	
	<div class="postDetails">
		<?php echo Mage::helper('faqs')->__('Posted in');?><?php foreach($post->getCats() as $title=>$url): ?>
		<a href="<?php echo $url; ?>"><?php echo $title; ?></a> 
		<?php endforeach; ?> By <?php echo $post->getUser(); ?>
	</div>
</div>
*/ ?>

<!-- Comment Section -->

<?php if($this->getCommentsEnabled()): ?>
	<?php $comments = $this->getComment(); ?>
    <div class="postTitle"><a name="commentBox" ></a>
        <h2><?php echo $this->getCommentTotalString($comments);?></h2>
    </div>
    
    <?php foreach ($comments as $comment):	?>
		<div class="commentWrapper">
			<div class="commentContent"><?php echo $comment->getComment();?></div>
			<div class="commentDetails"><?php echo Mage::helper('faqs')->__('Comment By ');?><?php echo $comment->getUser();?> - <?php echo $this->formatDate($comment->getCreatedTime(),"full",true);?></div>
		</div>
	<?php endforeach; ?>
	
	<?php if ($post->getComments()): ?>
		<div class="postError"><?php echo Mage::helper('faqs')->__('Comments are Closed for this post') ?></div>
	<?php else: ?>
		<?php if ($this->getLoginRequired()): ?>
			<?php if ($this->helper('customer')->isLoggedIn()): ?>
				<form action="<?php echo $this->getFormAction(); ?>" id="commentForm" method="post">  
				   <fieldset class="group-select">
						<h4 class="legend"><?php echo Mage::helper('faqs')->__('Submit Comment') ?></h4>
						<ul>
							<li>
												   
								<div class="input-box">
									<label for="comment"><?php echo Mage::helper('faqs')->__('Comment') ?><span class="required">*</span></label><br />
									<textarea name="comment" id="comment" title="<?php echo $this->__('Comment') ?>" class="required-entry input-text" style="height:150px;width:525px;" cols="50" rows="5"></textarea>
								</div>
							</li>
						</ul>
					</fieldset>
					<div class="button-set">
						<input name="post_id" type="hidden" value="<?php echo $post->getPostId();?>" />
						<input name="email" type="hidden" value="<?php echo $this->htmlEscape($this->helper('faqs')->getUserEmail()) ?>"/>
						<input name="user" type="hidden" value="<?php echo $this->htmlEscape($this->helper('faqs')->getUserName()) ?>"/>
						<p class="required"><?php echo $this->__('* Required Fields') ?></p>
						<button class="form-button" type="submit"><span><?php echo Mage::helper('faqs')->__('Submit Commment') ?></span></button>
					</div>
				</form>
				
				<script type="text/javascript">
					var contactForm = new VarienForm('commentForm', true);
				</script>            
				
			<?php else: ?>
				<p><?php echo Mage::helper('faqs')->__('You must be logged in to post a comment.');?></p>
				<p><a href="<?php echo $this->getUrl('customer/account/login'); ?>"><?php echo Mage::helper('faqs')->__('click here');?></a> <?php echo Mage::helper('faqs')->__('to log in');?></p>
			 <?php endif ?>
			 
		<?php else: ?>
		
			<form action="<?php echo $this->getFormAction(); ?>" id="commentForm" method="post">
				<fieldset class="group-select">
					<h4 class="legend"><?php echo Mage::helper('faqs')->__('Submit Comment') ?></h4>
					<ul>
						<li>
							<div class="input-box">
								<label for="name"><?php echo Mage::helper('faqs')->__('Name') ?> <span class="required">*</span></label><br />
								<input name="user" id="user" title="<?php echo $this->__('Name') ?>" value="<?php echo $this->htmlEscape($this->helper('faqs')->getUserName()) ?>" class="required-entry input-text" type="text" />
							</div>
						
							<div class="input-box">
								<label for="email"><?php echo Mage::helper('faqs')->__('Email') ?> <span class="required">*</span></label><br />
								<input name="email" id="email" title="<?php echo $this->__('Email') ?>" value="<?php echo $this->htmlEscape($this->helper('faqs')->getUserEmail()) ?>" class="required-entry input-text validate-email" type="text" />
							</div>
						
							<div class="clear"></div>
						
							<div class="input-box">
								<label for="comment"><?php echo Mage::helper('faqs')->__('Comment') ?><span class="required">*</span></label><br />
								<textarea name="comment" id="comment" title="<?php echo Mage::helper('faqs')->__('Comment') ?>" class="required-entry input-text" style="height:150px;width:525px;" cols="50" rows="5"></textarea>
							</div>
						</li>
					</ul>
				</fieldset>
				<div class="button-set">
					<input name="post_id" type="hidden" value="<?php echo $post->getPostId();?>" />
					<p class="required"><?php echo $this->__('* Required Fields') ?></p>
					<button class="form-button" type="submit"><span><?php echo Mage::helper('faqs')->__('Submit Commment') ?></span></button>
				</div>
			</form>
		
			<script type="text/javascript">
				var contactForm = new VarienForm('commentForm', true);
			</script>
		<?php endif; ?>
	<?php endif; ?>
<?php endif; ?>